<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统消息</title>
<link rel="stylesheet" type="text/css"
	href="/bsc/static/common/bootstrap/css/bootstrap.min.css" />
<script src="/bsc/static/js/jquery-3.1.1.js" type="text/javascript"
	charset="utf-8"></script> 
<script
	src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"
	type="text/javascript" charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table.min.js"
	type="text/javascript" charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js"
	type="text/javascript" charset="utf-8"></script> 
<link rel="stylesheet" type="text/css"
	href="../static/common/global.css" media="all">
 <link rel="stylesheet" type="text/css" href="../static/css/personal.css"
	media="all"> 
<script type="text/javascript">
$(document).ready(function() {
    /*全选与反选按钮*/
    $("#all").click(function() {
        var state = $("#all").prop("checked");
        if(state == true) {
            $("[name='option']").prop("checked", "checked");
        } else {
            $("[name='option']").prop("checked", "");
        }
    });
    
    /*------------------------------------------------------------------------------------*/
    /*根据复选框是否全部选中来判断全选框是否选中*/
    //获取当前页面数据条数
    var options = $("[name='option']");
    //给每一个复选框加上click事件
    $("input[name='option']").click(function() {
        //获取当前选中的复选框个数
        var i = $("input[name='option']:checked");
        //判断复选框选中个数是否等于当前页面数据条数
        if(i.length == options.length) { //如果两者值相等那么全选按钮也会选中
            $("#all").prop("checked", "checked");
        } else { //当两者值不相等时全选框便不会显示选中
            $("#all").prop("checked", "");
        }
    });

});


$(document).ready(function() {
	$("btn2").click(function(){
		formName.action="/bsc/biswechat/list";
		formName.submit();
	});
	
	$("#btn").click(function() {//绑定
		/* alert("ghvvv");  */
		document.forms[0].action ="/bsc/biswechat/toadd";
		document.forms[0].submit();
	});
	$("#delBtn").click(function(obj) {//绑定
		var array = "";
		var num = document.getElementsByName("option");
		for (var i = 0; i < num.length; i++) {
			if (num[i].checked) {
				array += num[i].value + ",";
			}
		}
		if (array.length > 0) {
			array = array.substring(0,array.length - 1);
			document.forms[0].action = "/bsc/biswechat/delete?ids="+ array;
			document.forms[0].submit();
		} else {
			alert("请选择需要删除的数据");
		}
	});
});
</script>
<title>系统消息</title>
</head>
<body>
<section class="layui-larry-box">
<blockquote class="layui-elem-quote news_search">
	<form class="form-inline" role="form" action="" method="post">
	<table>
	<tr> 
	<td height="50">
	<label for="opinion_id">收件人:</label><input type="text" name="username" placeholder="请输入收件人" style="width: 160px; height: 33px;" class="form-control">
	</td>
	<td>
	<label for="opinion_id">收件人账号：</label><input type="text" name="mobile" placeholder="请输入账号" style="width: 160px; height: 33px;" class="form-control">
	</td>
	<td>
	<label for="opinion_id">内容：</label><input type="text" name="content" placeholder="请输入内容" style="width: 160px; height: 33px;" class="form-control">
	</td>
	<td>
	<label for="sms_type">发送时间:</label><input type="date" style="width: 160px; height: 33px;" class="form-control" name="send_time1" placeholder="" value="" id="" class="form-control">
	</td>
	<td>
	<label for="sms_type">至</label><input type="date" style="width: 160px; height: 33px;" class="form-control" name="send_time2" placeholder="" value="" id="" >
	</td>
	<td><button type="butten" class="btn btn-info glyphicon glyphicon-search " id="btn2" value="查询">查询</button></td>
	<td><button type="reset" class="btn btn-danger glyphicon glyphicon-refresh " value="重置">重置</button></td>
	</tr>
	</table>
	</blockquote>
	<div class="layui-form news_list">
		<table class="table table-hover table-bordered" >
			<colgroup>
				<col width="5%">
				<col width="10%">
				<col width="10%">
				<col width="55%">
				<col width="20%">
			</colgroup>
			<thead>
				<tr class="active">
					<td colspan="8">
						<!-- <div class="form-group"> -->
						<input type="button" value="发送信息" id="btn" class="btn btn-info"  style="height: 35px;" />
						<input type="button" value="删除" id="delBtn"
						class="btn btn-danger" style="height: 35px;" />
						<!-- </div> -->
					</td>
				</tr>
				<tr class="active">
				<td><input type="checkbox" id="all">全选</label>
 			 	</td>
					<td class="text-center">收件人</td>
					<td class="text-center">收件人账号</td>
					<td class="text-center">内容</td>
					<td class="text-center">发送时间</td>
				</tr>
			</thead>
			<tbody class="news_content">
				<c:forEach items="${info.list}" var="wechat" >
					<tr> 
					<td><input type="checkbox" name="option" value="${wechat.record_id}"></td>
						<td class="text-center">${wechat.bis_custom_user.username}</td>
						<td class="text-center">${wechat.bis_custom_user.mobile }</td>
						<td class="text-center">${wechat.content}</td>
						<td class="text-center"><fmt:formatDate value="${wechat.create_time }"
								pattern="yyyy-MM-dd hh:mm:ss" /></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<div class="">
  <a href="#" class="btn btn-link glyphicon glyphicon-backward" onclick="up()">上一页</a>   <a class="btn btn-link glyphicon glyphicon-forward" href="#" onclick="next()" >下一页</a>
</div> 
	</form>
	</section>
<script type="text/javascript">
	//上一页
function up(){
	document.forms[0].action="/bsc/biswechat/list?page="+${info.prePage};
	document.forms[0].submit();
};
//下一页
function next(){
	document.forms[0].action="/bsc/biswechat/list?page="+${info.nextPage};
	document.forms[0].submit();
};
</script>
</body>
</html>